<?php

namespace App\Http\Controllers\Admin;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;

class BaseController extends Controller
{

    protected function success($data, $url = null)
    {
        $data = is_array($data) ? $data : [$data];

        $url = $url ? : url()->current();

        return redirect($url)->with('successes', $data);
    }

    protected function ok($msg = '操作成功')
    {
        return ['code' => 200, 'msg' => $msg];
    }

    protected function fail($msg = '操作失败')
    {
        return ['code' => 401, 'msg' => $msg];
    }
}
